home *** CD-ROM | disk | FTP | other *** search
/ Programming Windows 95 with MFC / Programming Windows 95 with MFC (Microsoft Programming Series)(097-0001465)(1996).iso / CODE / Chap03 / VisualKB / VisualKB.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-05  |  1.7 KB  |  71 lines

  1. //***********************************************************************
  2. //
  3. //  VisualKB.h
  4. //
  5. //***********************************************************************
  6.  
  7. #define MAX_STRINGS 12
  8.  
  9. class CMyApp : public CWinApp
  10. {
  11. public:
  12.     virtual BOOL InitInstance ();
  13. };
  14.  
  15. class CMainWindow : public CWnd
  16. {
  17. private:
  18.     int m_cxChar;
  19.     int m_cyChar;
  20.     int m_cyLine;
  21.     int m_nTextPos;
  22.     int m_nTabStops[7];
  23.     int m_nTextLimit;
  24.     int m_nMsgPos;
  25.     
  26.     HCURSOR m_hCursorArrow;
  27.     HCURSOR m_hCursorIBeam;
  28.  
  29.     CPoint m_ptTextOrigin;
  30.     CPoint m_ptHeaderOrigin;
  31.     CPoint m_ptUpperMsgOrigin;
  32.     CPoint m_ptLowerMsgOrigin;
  33.     CPoint m_ptCaretPos;
  34.  
  35.     CRect m_rcTextBox;
  36.     CRect m_rcTextBoxBorder;
  37.     CRect m_rcMsgBoxBorder;
  38.     CRect m_rcScroll;
  39.  
  40.     CString m_strInputText;
  41.     CString m_strMessages[MAX_STRINGS];
  42.  
  43.     int GetNearestPos (CPoint);
  44.     void PositionCaret (CDC* = NULL);
  45.     void DrawInputText (CDC*);
  46.     void ShowMessage (LPCTSTR, UINT, UINT, UINT);
  47.     void DrawMessageHeader (CDC*);
  48.     void DrawMessages (CDC*);
  49.  
  50. public:
  51.     CMainWindow ();
  52.  
  53. protected:
  54.     virtual void PostNcDestroy ();
  55.  
  56.     afx_msg int OnCreate (LPCREATESTRUCT);
  57.     afx_msg void OnPaint ();
  58.     afx_msg void OnSetFocus (CWnd*);
  59.     afx_msg void OnKillFocus (CWnd*);
  60.     afx_msg BOOL OnSetCursor (CWnd*, UINT, UINT);
  61.     afx_msg void OnLButtonDown (UINT, CPoint);
  62.     afx_msg void OnKeyDown (UINT, UINT, UINT);
  63.     afx_msg void OnKeyUp (UINT, UINT, UINT);
  64.     afx_msg void OnSysKeyDown (UINT, UINT, UINT);
  65.     afx_msg void OnSysKeyUp (UINT, UINT, UINT);
  66.     afx_msg void OnChar (UINT, UINT, UINT);
  67.     afx_msg void OnSysChar (UINT, UINT, UINT);
  68.  
  69.     DECLARE_MESSAGE_MAP ()
  70. };
  71.